package com.isdepci.project.result.controller;

import java.util.List;

import com.isdepci.project.result.service.IresultYearService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.isdepci.framework.aspectj.lang.annotation.Log;
import com.isdepci.framework.aspectj.lang.enums.BusinessType;
import com.isdepci.project.result.domain.resultYear;
import com.isdepci.framework.web.controller.BaseController;
import com.isdepci.framework.web.domain.AjaxResult;
import com.isdepci.common.utils.poi.ExcelUtil;
import com.isdepci.framework.web.page.TableDataInfo;

/**
 * 结果Controller
 *
 * @author isdepci
 * @date 2023-09-06
 */
@RestController
@RequestMapping("/result/resultYear")
public class resultYearController extends BaseController
{
    @Autowired
    private IresultYearService resultYearService;

    /**
     * 查询结果列表
     */
    @PreAuthorize("@ss.hasPermi('result:resultYear:list')")
    @GetMapping("/list")
    public TableDataInfo list(resultYear resultYear)
    {
        startPage();
        List<resultYear> list = resultYearService.selectresultYearList(resultYear);
        return getDataTable(list);
    }

    /**
     * 导出结果列表
     */
    @PreAuthorize("@ss.hasPermi('result:resultYear:export')")
    @Log(title = "结果", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(resultYear resultYear)
    {
        List<resultYear> list = resultYearService.selectresultYearList(resultYear);
        ExcelUtil<resultYear> util = new ExcelUtil<resultYear>(resultYear.class);
        return util.exportExcel(list, "result");
    }

    /**
     * 获取结果详细信息
     */
    @PreAuthorize("@ss.hasPermi('result:resultYear:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(resultYearService.selectresultYearById(id));
    }

    /**
     * 新增结果
     */
    @PreAuthorize("@ss.hasPermi('result:resultYear:add')")
    @Log(title = "结果", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody resultYear resultYear)
    {
        return toAjax(resultYearService.insertresultYear(resultYear));
    }

    /**
     * 修改结果
     */
    @PreAuthorize("@ss.hasPermi('result:resultYear:edit')")
    @Log(title = "结果", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody resultYear resultYear)
    {
        return toAjax(resultYearService.updateresultYear(resultYear));
    }

    /**
     * 删除结果
     */
    @PreAuthorize("@ss.hasPermi('result:resultYear:remove')")
    @Log(title = "结果", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(resultYearService.deleteresultYearByIds(ids));
    }
}
